void test2()
{
    int x = 0;
    do
    {
        int m = float_f2i(x);
        int n = (int)u2f(x);
        if(m != n)
        {
            printf("error in %x:  %d %d\n", x, m, n);
            return;
        }
        x++;
    }
    while(x!=0);

    printf("Test OK\n");
}

int float_f2i(float_bits f)
{
    unsigned sign=f>>31;
    unsigned exp=f>>23&0xff;
    unsigned frac=f&0x7fffff;
    if(exp<0x7f)
        return 0;
    else if(exp>158 ||(exp==158&&frac>0))
        return 0x80000000;
    int c=exp-0x7f;
    if(c>23)
        frac= ((1<<23)|frac)<<(c-23);
    else
        frac= (frac>>(23-c))|(1<<c);
    return sign?(~frac+1):frac;
}
